<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="__PUBLIC__/css/reset.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/css/style.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function() {
   $("#allck").bind('click',function () {
	 if($('#allck').attr("checked")){
	 $("#dbck input:checkbox").attr("checked",true);}
	 else{$("#dbck input:checkbox").attr("checked",false);}
   });
   $("#dbback").click(function() {
	   var db="";
	   if($('#list input:checked').val()=="1")
	   {
		   db="allback";
		   }
	   if($('#list input:checked').val()=="2")
	   {
		   $("#dbck input:checked").each(function(){
			  db+=$(this).val()+',';
		   });
		   }
	   if(db=="")
	   {
		   alert("请选择要备份的表");
		   return;
		   }
	   //删除提示
	   $.ajax({
		   type: "POST",

		   url: "__URL__/backup",
		   {literal}
		   data: { tbName:db,dbsize:$('#dbsize').val(),dbsql:$('#dbsql').val()},
		   success: function(data) {
		   if(data==1){alert("备份成功！");}else{alert("备份失败！");}
		   }
		});
   });
   $("#dbinfo").hide();
});
function show()
{
	$("#dbinfo").show();
	}
function hide()
{
	$("#dbinfo").hide();
	}
</script>

</head>
<body>
<div id="main_frameid" class="pad-10 display" style="_margin-right:-12px;_width:98.9%;">
<div class="col-2 lf mr10 col">
	<h6>├ 备份数据</h6>
	<div class="content">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="list">
      <tr>
        <td width="20%"><input name="back" type="radio" value="1" onclick="hide()" checked="checked" /> 全部备份</td>
        <td>备份数据库所有表</td>
      </tr>
      <tr>
        <td><input id="zdy" name="back" type="radio" value="2" onclick="show()"/>自定义备份</td>
        <td>根据自行选择备份数据表</td>
      </tr>
      <tr>
        <td colspan="2" id="dbinfo">
        <input id="allck" name="" type="checkbox" value="" style="margin-left:10px;" /> 全选
        <div id="dbck">

         <?php    foreach ($table as $key) {
                  ?>
               <span><input name="" type="checkbox" value="{$key}" /> {$key}</span>

        <?php } ?>

                </div>
		</td>
      </tr>
      <tr>
        <td>大小</td>
        <td><input id="dbsize" name="dbsize" type="text" style="border:1px solid #cadcb2;"  value="2048"/></td>
      </tr>
      <tr>
        <td>备份文件名</td>
        <td><input id="dbsql" name="dbsql" type="text" style="border:1px solid #cadcb2;" value="{$dbname}" /></td>
      </tr>
      <tr>
        <td><input type="hidden" name="do" value="yes" /></td>
        <td><input id="dbback" name="submit" type="button" style="border:1px solid #cadcb2;" value="备份数据" /></td>
      </tr>
    </table>
	</div>
</div>
</div>
</body>
</html>